package com.freewater.springboot.demo.ioc.lookupmethodinject.useannotation;

import com.freewater.springboot.demo.ioc.lookupmethodinject.Command;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class SyncCommand implements Command {

    private Object state;

    @Override
    public void setState(Object state) {
        this.state = state;
    }

    @Override
    public void execute() {
        log.info("this command：{}, state: {}", this, this.state);
        // do something
    }
}
